home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG Revelations
/
BMUG Revelations.toast
/
Programming
/
Programming Languages
/
Yerk 3.64
/
Float source
/
fArgs
< prev
next >
Wrap
Text File
|
1990-12-22
|
6KB
|
165 lines
\ support for floating point named input parms
\ 9/22/85 cbd Version 1.0
\ 12/03/87 rfl added ;m
\ fetch the 0th floating point arg
:CODE @fp0
move.l YERK[(fltNew)],d7
jsr 0(a3,d7.l) ; get new float in d1
clr.l d0
move.l d5,a2 ; get mstack
move.l 8(a2),d0 ; get float value
lea 2(a3,d0.l),a0 ; get addr of arg's data
lea 2(a3,d1.l),a1 ; get addr of new float's data
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
move.w (a0)+,(a1)+
move.l d1,-(a7) ; push the new float
;CODE
:CODE @fp1
move.l YERK[(fltNew)],d7
jsr 0(a3,d7.l) ; get new float in d1
clr.l d0
move.l d5,a2 ; get mstack
move.l 12(a2),d0 ; get float value
lea 2(a3,d0.l),a0 ; get addr of arg's data
lea 2(a3,d1.l),a1 ; get addr of new float's data
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
move.w (a0)+,(a1)+
move.l d1,-(a7) ; push the new float
;CODE
\ fetch the floating point arg whose offset is at the IP
:CODE @fp2
move.l YERK[(fltNew)],d7
jsr 0(a3,d7.l) ; get new float in d1
clr.l d0
move.l d5,a2 ; get mstack
move.l 16(a2),d0 ; get float value
lea 2(a3,d0.l),a0 ; get addr of arg's data
lea 2(a3,d1.l),a1 ; get addr of new float's data
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
move.w (a0)+,(a1)+
move.l d1,-(a7) ; push the new float
;CODE
\ fetch the floating point arg whose offset is at the IP
:CODE @fp3
move.l YERK[(fltNew)],d7
jsr 0(a3,d7.l) ; get new float in d1
clr.l d0
move.l d5,a2 ; get mstack
move.l 20(a2),d0 ; get float value
lea 2(a3,d0.l),a0 ; get addr of arg's data
lea 2(a3,d1.l),a1 ; get addr of new float's data
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
move.w (a0)+,(a1)+
move.l d1,-(a7) ; push the new float
;CODE
\ fetch the floating point arg whose offset is at the IP
:CODE @fp4
move.l YERK[(fltNew)],d7
jsr 0(a3,d7.l) ; get new float in d1
clr.l d0
move.l d5,a2 ; get mstack
move.l 24(a2),d0 ; get float value
lea 2(a3,d0.l),a0 ; get addr of arg's data
lea 2(a3,d1.l),a1 ; get addr of new float's data
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
move.w (a0)+,(a1)+
move.l d1,-(a7) ; push the new float
;CODE
\ fetch the floating point arg whose offset is at the IP
:CODE @fp5
move.l YERK[(fltNew)],d7
jsr 0(a3,d7.l) ; get new float in d1
clr.l d0
move.l d5,a2 ; get mstack
move.l 28(a2),d0 ; get float value
lea 2(a3,d0.l),a0 ; get addr of arg's data
lea 2(a3,d1.l),a1 ; get addr of new float's data
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
move.w (a0)+,(a1)+
move.l d1,-(a7) ; push the new float
;CODE
\ store a new float in the arg whose offset is at the IP
:CODE !fp(ip)
move.w (a4)+,d2 ; pickup arg offset
move.l d5,a2 ; get mstack
move.l 0(a2,d2.w),d0 ; get old float value
beq noDisp ; if 0, don't dispose
move.l YERK[(fltDisp)],d7
jsr 0(a3,d7.l) ; dispose of old float
noDisp move.l (a7)+,0(a2,d2.w) ; store new float in mstack cell
;CODE
\ add a float to the arg whose offset is at the IP
:CODE +fp(ip)
move.w (a4)+,d2 ; pickup arg offset
move.l d5,a2 ; get mstack
move.l 0(a2,d2.w),d1 ; get contents of arg in d1 = rcvr
beq notInit ; if 0, don't proceed
move.l (a7)+,d0 ; get parm
pea 2(a3,d0.l) ; push parm absolute
pea 2(a3,d1.l) ; push rcvr absolute
move.l YERK[(fltDisp)],d7 ; get subr addr in d7
jsr 0(a3,d7.l) ; go dispose of parm in d0
clr.w -(A7) ; code for FADD
call pack4
move.l (a4)+,d6 ; do next
move.l 0(a3,d6.l),d7
jmp 0(a3,d7.l)
notInit move.l #3,d1
move.l YERK[fpErr],d7
move.l YERK[execWord],d6
jmp 0(a3,d6.l)
;CODE
\ deallocate the floats held in named input args. This cfa
\ is compiled before (;m) in words that have float args. A 16-bit word at
\ the IP holds a bitmask indicating which args are float.
:CODE killFargs
move.w (a4)+,d2 ; get bitmask
move.l d5,a2 ; get mstack
move.l YERK[(fltDisp)],d7
addq.l #8,a2 ; point to 0th arg
kf1 asr.w #1,d2 ; shift low bit into carry
bcc noDisp ; if carry clear, not a float
beq kfLast ; if 0, no more to shift
move.l (a2),d0 ; get the float
beq noDisp ; skip uninitialized floats
jsr 0(a3,d7.l) ; kill it
noDisp addq.l #4,a2 ; next cell
bra kf1 ; loop
kfLast move.l (a2),d0 ; get the float
jsr 0(a3,d7.l) ; kill it
;CODE
'c @fp0 fpicks !
'c @fp1 fpicks 4+ !
'c @fp2 fpicks 8+ !
'c @fp3 fpicks 12 + !
'c @fp4 fpicks 16 + !
'c @fp5 fpicks 20 + !
'c !fp(ip) -> farg!
'c +fp(ip) -> farg++
'c killfargs -> fkill
\ ;M checks if the latest method has named float args, and if so,
\ compiles the float disposal routine before the end of the method.
: ;M ?csp ?class ^class mfa @ 14 + dup c@
IF 1+ c@ dup IF fkill , w, ELSE drop THEN
ELSE drop
THEN compile (;m) ; immediate